home *** CD-ROM | disk | FTP | other *** search
/ MacWarehouse Macintosh Games / MacWarehouse Macintosh Games.iso / AMBER demo / ROXY / ROXY.dxr / 00013_Roxy's door-handlers.ls < prev    next >
Encoding:
Text File  |  1996-10-18  |  13.2 KB  |  359 lines

  1. on setKitchenRearDoorIsOpen suggestion
  2.   global oStoryteller, oPuppeteer
  3.   set currentState to getState(oStoryteller, #kitchenRearDoorIsOpen)
  4.   set currentRoom to the gHotSublist of oPuppeteer
  5.   if (suggestion = 0) and (currentState = 1) then
  6.     set the queuedSound of oPuppeteer to #kitchenExitClose
  7.     setProp(the lsStateData of oStoryteller, #kitchenRearDoorIsOpen, [0])
  8.     updateDisplay(oPuppeteer)
  9.     if (currentRoom = #DarkDn) or (currentRoom = #kitchen) then
  10.       endLoop(#grounds)
  11.     end if
  12.     if currentRoom = #Ghse then
  13.       endLoop(#houseHum)
  14.     end if
  15.     if (currentRoom = #kitchen) and (getState(oStoryteller, #DoorWithScanUnit) = #kitchenOutside) and (getState(oStoryteller, #scanUnitIsActive) = 1) then
  16.       endLoop(#scanLoop)
  17.     end if
  18.   end if
  19.   if (suggestion = 1) and (currentState = 0) then
  20.     set the queuedSound of oPuppeteer to #kitchenExitOpen
  21.     setProp(the lsStateData of oStoryteller, #kitchenRearDoorIsOpen, [1])
  22.     updateDisplay(oPuppeteer)
  23.     if (currentRoom = #DarkDn) or (currentRoom = #kitchen) then
  24.       setLoop(#grounds, 180)
  25.     end if
  26.     if (currentRoom = #kitchen) and (getState(oStoryteller, #DoorWithScanUnit) = #kitchenOutside) and (getState(oStoryteller, #scanUnitIsActive) = 1) then
  27.       setLoop(#scanLoop, 120)
  28.     end if
  29.   end if
  30. end
  31.  
  32. on setBoathouseDoorIsOpen suggestion
  33.   global oStoryteller, oPuppeteer
  34.   set currentState to getState(oStoryteller, #boatHouseDoorIsOpen)
  35.   if (suggestion = 0) and (currentState = 1) then
  36.     set the queuedSound of oPuppeteer to #cabinetClose
  37.     setProp(the lsStateData of oStoryteller, #boatHouseDoorIsOpen, [0])
  38.     killVideo()
  39.     updateDisplay(oPuppeteer)
  40.   end if
  41.   if (suggestion = 1) and (currentState = 0) then
  42.     set the queuedSound of oPuppeteer to #cabinetOpen
  43.     setProp(the lsStateData of oStoryteller, #boatHouseDoorIsOpen, [1])
  44.     updateDisplay(oPuppeteer)
  45.   end if
  46. end
  47.  
  48. on setFrontDoorIsOpen suggestion
  49.   global oStoryteller, oPuppeteer
  50.   set currentState to getState(oStoryteller, #FrontDoorIsOpen)
  51.   set currentRoom to the gHotSublist of oPuppeteer
  52.   if (suggestion = 0) and (currentState = 1) then
  53.     set the queuedSound of oPuppeteer to #frontDoorClose
  54.     setProp(the lsStateData of oStoryteller, #FrontDoorIsOpen, [0])
  55.     updateDisplay(oPuppeteer)
  56.     if (currentRoom = #DarkDn) or (currentRoom = #Hall) then
  57.       endLoop(#grounds)
  58.     end if
  59.     if currentRoom = #Porch then
  60.       endLoop(#houseHum)
  61.     end if
  62.   end if
  63.   if (suggestion = 1) and (currentState = 0) then
  64.     set the queuedSound of oPuppeteer to #frontDoorOpen
  65.     setProp(the lsStateData of oStoryteller, #FrontDoorIsOpen, [1])
  66.     updateDisplay(oPuppeteer)
  67.     if (currentRoom = #DarkDn) or (currentRoom = #Hall) then
  68.       setLoop(#grounds, 180)
  69.     end if
  70.     if currentRoom = #Porch then
  71.       setLoop(#houseHum, 80)
  72.     end if
  73.   end if
  74. end
  75.  
  76. on setBalconyDoorIsOpen suggestion
  77.   global oStoryteller, oPuppeteer
  78.   set currentState to getState(oStoryteller, #balconyDoorIsOpen)
  79.   set currentLoc to getState(oStoryteller, #currentLocation)
  80.   if (suggestion = 0) and (currentState = 1) then
  81.     set the queuedSound of oPuppeteer to #doorClose
  82.     setProp(the lsStateData of oStoryteller, #balconyDoorIsOpen, [0])
  83.     updateDisplay(oPuppeteer)
  84.     if getPos([#UHallBalconyEntry, #UHallNwall2, #DarkUp_UHallNwall2, #DarkUp_BalcEntry], currentLoc) then
  85.       endLoop(#grounds)
  86.     end if
  87.     if getPos([#UHallBalconyN, #UHallBalconyS, #DarkUp_BalcNorth, #DarkUp_BalcSouth], currentLoc) then
  88.       endLoop(#houseHum)
  89.     end if
  90.   end if
  91.   if (suggestion = 1) and (currentState = 0) then
  92.     set the queuedSound of oPuppeteer to #doorOpen
  93.     setProp(the lsStateData of oStoryteller, #balconyDoorIsOpen, [1])
  94.     updateDisplay(oPuppeteer)
  95.     if getPos([#UHallBalconyEntry, #UHallNwall2, #DarkUp_UHallNwall2, #DarkUp_BalcEntry], currentLoc) then
  96.       setLoop(#grounds, 180)
  97.     end if
  98.     if getPos([#UHallBalconyN, #UHallBalconyS, #DarkUp_BalcNorth, #DarkUp_BalcSouth], currentLoc) then
  99.       setLoop(#houseHum, 80)
  100.     end if
  101.   end if
  102. end
  103.  
  104. on setFortiesBedroomDoorIsOpen suggestion
  105.   global oStoryteller, oPuppeteer
  106.   set currentState to getState(oStoryteller, #FortiesBedroomDoorIsOpen)
  107.   if (suggestion = 0) and (currentState = 1) then
  108.     set the queuedSound of oPuppeteer to #doorClose
  109.     setProp(the lsStateData of oStoryteller, #FortiesBedroomDoorIsOpen, [0])
  110.     updateDisplay(oPuppeteer)
  111.   end if
  112.   if (suggestion = 1) and (currentState = 0) then
  113.     set the queuedSound of oPuppeteer to #doorOpen
  114.     setProp(the lsStateData of oStoryteller, #FortiesBedroomDoorIsOpen, [1])
  115.     updateDisplay(oPuppeteer)
  116.   end if
  117. end
  118.  
  119. on setBathroomDoorIsOpen suggestion
  120.   global oStoryteller, oPuppeteer
  121.   set currentState to getState(oStoryteller, #bathroomDoorIsOpen)
  122.   if (suggestion = 0) and (currentState = 1) then
  123.     set the queuedSound of oPuppeteer to #doorClose
  124.     setProp(the lsStateData of oStoryteller, #bathroomDoorIsOpen, [0])
  125.     updateDisplay(oPuppeteer)
  126.   end if
  127.   if (suggestion = 1) and (currentState = 0) then
  128.     set the queuedSound of oPuppeteer to #doorOpen
  129.     setProp(the lsStateData of oStoryteller, #bathroomDoorIsOpen, [1])
  130.     updateDisplay(oPuppeteer)
  131.   end if
  132. end
  133.  
  134. on setGarageDoorIsOpen suggestion
  135.   global oStoryteller, oPuppeteer
  136.   set currentState to getState(oStoryteller, #GarageDoorIsOpen)
  137.   set currentRoom to the gHotSublist of oPuppeteer
  138.   if (suggestion = 0) and (currentState = 1) then
  139.     soundEffect(#garageDoorClose)
  140.     wait(15)
  141.     setProp(the lsStateData of oStoryteller, #GarageDoorIsOpen, [0])
  142.     updateDisplay(oPuppeteer)
  143.     if currentRoom = #Garage then
  144.       endLoop(#grounds, 80)
  145.     else
  146.       endLoop(#Garage)
  147.     end if
  148.   end if
  149.   if (suggestion = 1) and (currentState = 0) then
  150.     soundEffect(#garageDoorOpen)
  151.     wait(10)
  152.     setProp(the lsStateData of oStoryteller, #GarageDoorIsOpen, [1])
  153.     updateDisplay(oPuppeteer)
  154.     if currentRoom = #Garage then
  155.       setLoop(#grounds, 180)
  156.     else
  157.       setLoop(#Garage, 120)
  158.     end if
  159.   end if
  160. end
  161.  
  162. on setShowerDoorIsOpen suggestion
  163.   global oStoryteller, oPuppeteer
  164.   set currentState to getState(oStoryteller, #showerDoorIsOpen)
  165.   if (suggestion = 0) and (currentState = 1) then
  166.     set the queuedSound of oPuppeteer to #showerClose
  167.     setProp(the lsStateData of oStoryteller, #showerDoorIsOpen, [0])
  168.     updateDisplay(oPuppeteer)
  169.   end if
  170.   if (suggestion = 1) and (currentState = 0) then
  171.     set the queuedSound of oPuppeteer to #showerOpen
  172.     setProp(the lsStateData of oStoryteller, #showerDoorIsOpen, [1])
  173.     updateDisplay(oPuppeteer)
  174.   end if
  175. end
  176.  
  177. on setMailboxIsOpen suggestion
  178.   global oStoryteller, oPuppeteer
  179.   set currentState to getState(oStoryteller, #mailboxIsOpen)
  180.   if (suggestion = 0) and (currentState = 1) then
  181.     set the queuedSound of oPuppeteer to #mailboxClose
  182.     setProp(the lsStateData of oStoryteller, #mailboxIsOpen, [0])
  183.     updateDisplay(oPuppeteer)
  184.   end if
  185.   if (suggestion = 1) and (currentState = 0) then
  186.     set the queuedSound of oPuppeteer to #mailboxOpen
  187.     setProp(the lsStateData of oStoryteller, #mailboxIsOpen, [1])
  188.     updateDisplay(oPuppeteer)
  189.   end if
  190. end
  191.  
  192. on setStudyDrawerIsOpen suggestion
  193.   global oStoryteller, oPuppeteer
  194.   set currentState to getState(oStoryteller, #studyDrawerIsOpen)
  195.   if (suggestion = 0) and (currentState = 1) then
  196.     set the queuedSound of oPuppeteer to #drawerClose
  197.     setProp(the lsStateData of oStoryteller, #studyDrawerIsOpen, [0])
  198.     updateDisplay(oPuppeteer)
  199.   end if
  200.   if (suggestion = 1) and (currentState = 0) then
  201.     set the queuedSound of oPuppeteer to #drawerOpen
  202.     setProp(the lsStateData of oStoryteller, #studyDrawerIsOpen, [1])
  203.     updateDisplay(oPuppeteer)
  204.   end if
  205. end
  206.  
  207. on setOfficeDrawerIsOpen suggestion
  208.   global oStoryteller, oPuppeteer
  209.   set currentState to getState(oStoryteller, #officeDrawerIsOpen)
  210.   if (suggestion = #none) and (currentState <> #none) then
  211.     set the queuedSound of oPuppeteer to #OfficeDrawerClose
  212.     setProp(the lsStateData of oStoryteller, #officeDrawerIsOpen, [suggestion])
  213.     updateDisplay(oPuppeteer)
  214.   end if
  215.   if (suggestion <> #none) and (currentState = #none) then
  216.     set the queuedSound of oPuppeteer to #OfficeDrawerOpen
  217.     setProp(the lsStateData of oStoryteller, #officeDrawerIsOpen, [suggestion])
  218.     updateDisplay(oPuppeteer)
  219.   end if
  220. end
  221.  
  222. on setDiningRmCabinetIsOpen suggestion
  223.   global oStoryteller, oPuppeteer
  224.   set currentState to getState(oStoryteller, #diningRmCabinetIsOpen)
  225.   if (suggestion = #none) and (currentState <> #none) then
  226.     set the queuedSound of oPuppeteer to #sideboardClose
  227.     setProp(the lsStateData of oStoryteller, #diningRmCabinetIsOpen, [suggestion])
  228.     updateDisplay(oPuppeteer)
  229.   end if
  230.   if (suggestion <> #none) and (currentState = #none) then
  231.     set the queuedSound of oPuppeteer to #sideboardOpen
  232.     setProp(the lsStateData of oStoryteller, #diningRmCabinetIsOpen, [suggestion])
  233.     updateDisplay(oPuppeteer)
  234.   end if
  235. end
  236.  
  237. on setBedrmCabinetIsOpen suggestion
  238.   global oStoryteller, oPuppeteer
  239.   set currentState to getState(oStoryteller, #bedrmCabinetIsOpen)
  240.   if (suggestion = #none) and (currentState <> #none) then
  241.     if getPos([#bureau1, #bureau2, #bureau3, #leftTable, #rightTable], currentState) then
  242.       set the queuedSound of oPuppeteer to #drawerClose
  243.     end if
  244.     if currentState = #armoire then
  245.       set the queuedSound of oPuppeteer to #cabinetClose
  246.     end if
  247.     if currentState = #closet then
  248.       set the queuedSound of oPuppeteer to #doorClose
  249.     end if
  250.     setProp(the lsStateData of oStoryteller, #bedrmCabinetIsOpen, [suggestion])
  251.     updateDisplay(oPuppeteer)
  252.   end if
  253.   if (suggestion <> #none) and (currentState = #none) then
  254.     if getPos([#bureau1, #bureau2, #bureau3, #leftTable, #rightTable], suggestion) then
  255.       set the queuedSound of oPuppeteer to #drawerOpen
  256.     end if
  257.     if suggestion = #armoire then
  258.       set the queuedSound of oPuppeteer to #cabinetOpen
  259.     end if
  260.     if suggestion = #closet then
  261.       set the queuedSound of oPuppeteer to #doorOpen
  262.     end if
  263.     setProp(the lsStateData of oStoryteller, #bedrmCabinetIsOpen, [suggestion])
  264.     updateDisplay(oPuppeteer)
  265.   end if
  266. end
  267.  
  268. on setKitchenCabinetIsOpen suggestion
  269.   global oStoryteller, oPuppeteer
  270.   set currentState to getState(oStoryteller, #kitchenCabinetIsOpen)
  271.   if (suggestion = #none) and (currentState <> #none) then
  272.     if getPos([#upperLeft, #upperMiddle, #upperRight, #lowerLeft, #lowerMiddle, #lowerRight, #cupboard], currentState) then
  273.       set the queuedSound of oPuppeteer to #cabinetClose
  274.     else
  275.       if currentState = #trashcan then
  276.         set the queuedSound of oPuppeteer to #cabinetClose
  277.       end if
  278.       if currentState = #drawer then
  279.         set the queuedSound of oPuppeteer to #drawerClose
  280.       end if
  281.       if currentState = #silverDrawer then
  282.         set the queuedSound of oPuppeteer to #silverDrawerClose
  283.       end if
  284.     end if
  285.     setProp(the lsStateData of oStoryteller, #kitchenCabinetIsOpen, [suggestion])
  286.     updateDisplay(oPuppeteer)
  287.   end if
  288.   if (suggestion <> #none) and (currentState = #none) then
  289.     if getPos([#upperLeft, #upperMiddle, #upperRight, #lowerLeft, #lowerMiddle, #lowerRight, #cupboard], suggestion) then
  290.       set the queuedSound of oPuppeteer to #cabinetOpen
  291.     else
  292.       if suggestion = #drawer then
  293.         set the queuedSound of oPuppeteer to #drawerOpen
  294.       end if
  295.       if suggestion = #silverDrawer then
  296.         set the queuedSound of oPuppeteer to #silverDrawerOpen
  297.       end if
  298.     end if
  299.     setProp(the lsStateData of oStoryteller, #kitchenCabinetIsOpen, [suggestion])
  300.     updateDisplay(oPuppeteer)
  301.   end if
  302.   if suggestion = #trashcan then
  303.     set the queuedSound of oPuppeteer to #drawerOpen
  304.     setProp(the lsStateData of oStoryteller, #kitchenCabinetIsOpen, [suggestion])
  305.     updateDisplay(oPuppeteer)
  306.   end if
  307. end
  308.  
  309. on testForMargGhost
  310.   global oPuppeteer, oStoryteller, gCPU
  311.   set activeHaunts to getProp(the lsStateData of oStoryteller, #hauntsRemaining)
  312.   if getPos(activeHaunts, #ghostBrushingHair) then
  313.     cursorOff()
  314.     if gCPU = #PC then
  315.       suspendSounds(#fadeOut)
  316.     end if
  317.     pushVideo()
  318.     wait(#videoStop)
  319.     if gCPU = #PC then
  320.       restoreSounds(#fadeIn)
  321.     end if
  322.     trimState(#hauntsRemaining, #ghostBrushingHair)
  323.   end if
  324. end
  325.  
  326. on testForMirrorMsg
  327.   global oPuppeteer, oStoryteller, gCPU
  328.   set activeHaunts to getProp(the lsStateData of oStoryteller, #hauntsRemaining)
  329.   if getPos(activeHaunts, #mirrorMessage) then
  330.     cursorOff()
  331.     if gCPU = #PC then
  332.       suspendSounds(#fadeOut)
  333.     end if
  334.     pushVideo()
  335.     wait(#videoStop)
  336.     if gCPU = #PC then
  337.       restoreSounds(#fadeIn)
  338.     end if
  339.     trimState(#hauntsRemaining, #mirrorMessage)
  340.   end if
  341. end
  342.  
  343. on setDoorWithScanUnit suggestion
  344.   global oStoryteller, oPuppeteer
  345.   set validKnobs to [#none, #kitchenOutside, #kitchenInside, #margaretRmInside, #margaretRmOutside, #bathroomInside, #bathroomOutside, #garageInside, #garageOutside, #boathouseInside, #boatHouseOutside]
  346.   if getPos(validKnobs, suggestion) <> 0 then
  347.     set oldValue to getState(oStoryteller, #DoorWithScanUnit)
  348.     if (suggestion = #none) and (oldValue <> #none) then
  349.       set the queuedSound of oPuppeteer to #scanOffKnob
  350.     end if
  351.     if (suggestion <> #none) and (oldValue = #none) then
  352.       set the queuedSound of oPuppeteer to #scanOntoKnob
  353.     end if
  354.     setProp(the lsStateData of oStoryteller, #DoorWithScanUnit, [suggestion])
  355.   else
  356.     put "Sorry, " & suggestion & " isn't a valid knob for the state-var #doorWithScanUnit.."
  357.   end if
  358. end
  359.